package com.lock;

import com.alibaba.fastjson.JSONObject;
import exam.common.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/5/20 17:09
 * @since JDK 1.8
 */
@RestController
@Api("锁的测试")
public class LockController {

    final transient ReentrantLock lock = new ReentrantLock();

    @GetMapping("lock")
    public JSONObject lockController(){
        lock.lock();
        try {

        } finally {
            lock.unlock();
        }
        return Result.successObject();
    }
}
